﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name = 'Account')
	BEGIN
		DROP  Table Account
	END
GO

CREATE TABLE Account
(
   AccountId int identity (1,1) not null,
   Username nvarchar(256) not null,
   DateOfBirth smalldatetime not null,
   UnitOfLengthId int not null,
   UnitOfWeightId int not null
   
   constraint pkAccount primary key (AccountId),
   constraint fkAccountToUnitOfLength foreign key (UnitOfLengthId) references UnitOfLength (UnitOfLengthId),
   constraint fkAccountToUnitOfWeight foreign key (UnitOfWeightId) references UnitOfWeight (UnitOfWeightId)
   /*
   May constrain this later but as Asp.net manages the membership at the minute it feels dangerous to link them - it will
   cause asp to fall over during dev - should be linked when custom delete account is rolled
   constraint fkAccountToAspLogin foreign key (AspLogin) references aspnet_Users (UserId)*/
)
GO

